package com.eastseeway.radioproject.database;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.eastseeway.radioproject.entities.VersionBean;

import java.util.List;

@Dao
public interface VersionInfoDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void addVersionInfo(VersionBean versionBean);

    @Query("UPDATE VersionBean SET softStyle = :softStyle, softVer = :softVer,softFile = :softFile,updateTime = :updateTime WHERE address = :address")
    int updateItemName(String softStyle, String softVer,String softFile,String updateTime,int address);

    @Update
    void updateVersionInfo(VersionBean versionBean);

    @Query("SELECT softVer FROM VersionBean WHERE softStyle = :softStyle")
    String queryVersionCodeInfo(String softStyle);

    @Query("SELECT * FROM VersionBean")
    LiveData<List<VersionBean>> queryAllVersion();

}
